using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using CE.User;

public partial class User_AccountConfirmation : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.Params["confirmKey"] != null)
            {
                string _confirmKey = Request.Params["confirmKey"];
                AccountDB _accountdb = new AccountDB();
                bool _result = _accountdb.ActivateAccount(_confirmKey);
                if (_result)
                {
                    //Response.Redirect("~/User/UserMessage.aspx?errorcode=200");
                    Response.Redirect("~/User/UserMessage.aspx?mt=UM&ec=200");
                }
                else
                {
                    //Response.Redirect("~/User/UserMessage.aspx?errorcode=404");
                    Response.Redirect("~/User/UserMessage.aspx?mt=UM&ec=404");
                }
            }
            LogUserViewedHistory();
        }
    }

    private void LogUserViewedHistory()
    {
        UserViewHistoryDB _userviewdb = new UserViewHistoryDB();
        _userviewdb.LogViewedHistory("USR", Request, "User account confirmation.");
    }
}
